#include<stdio.h>
int main(int argc, char const *argv[])
{
    int consume,cash=0,deposit=0,res;
    for (int i = 1; i < 13; i++)
    {
        scanf("%d",&consume);
        cash += 300 - consume;
        if (cash<0){
            printf("-%d",i);
            return 0;
        }
        deposit += cash/100 * 100;
        cash %= 100;
    }
    deposit += deposit/5;
    printf("%d",deposit+cash);
    return 0;
}
